﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                    xmlns:local="clr-namespace:Codemonk.EvilBox.Controls">

    <Style TargetType="{x:Type local:WidgetPanel}">
        <Setter Property="Background" Value="#FF1E1E1E"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:WidgetPanel}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}" Margin="0"
                            BorderThickness="{TemplateBinding BorderThickness}" Padding="0">
                        <ListBox ItemsSource="{TemplateBinding Widgets}" 
                                   Background="Transparent" SelectionMode="Extended"
                                 VerticalContentAlignment="{ TemplateBinding VerticalContentAlignment}"
                                 HorizontalContentAlignment="{ TemplateBinding HorizontalContentAlignment}">
                            <ListBox.Resources>
                                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
                                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
                            </ListBox.Resources>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel HorizontalAlignment="Left"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <ContentPresenter Content="{Binding}"   >
                                        <i:Interaction.Behaviors >
                                            <ei:MouseDragElementBehavior ConstrainToParentBounds="False"/>
                                            <ei:TranslateZoomRotateBehavior ConstrainToParentBounds="False"/>
                                            <ei:FluidMoveBehavior Duration="0:0:2"  >
                                                <ei:FluidMoveBehavior.EaseY>
                                                    <BackEase EasingMode="EaseOut"/>
                                                </ei:FluidMoveBehavior.EaseY>
                                                <ei:FluidMoveBehavior.EaseX>
                                                    <BackEase EasingMode="EaseOut"/>
                                                </ei:FluidMoveBehavior.EaseX>
                                            </ei:FluidMoveBehavior>
                                        </i:Interaction.Behaviors>
                                    </ContentPresenter>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>